#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 6446;
const int Mod = 1e9 + 7;
int a[N], t[N], p[N], fac[N];
int n, ans, Max;
void dfs(int x) {
	if(x == n + 1) {
		int cnt = 0;
		for(int l = 1; l <= n; l++) {
			for(int r = l; r <= n; r++) {
				int fl = 0;
				for(int i = l; i <= r; i++) {
					if(p[i] != p[r + l - i]) {
						fl = 1;
						break;
					}
				}
				if(!fl) ++cnt;
			}
		}
		
		if(cnt > Max) Max = cnt, ans = 1;
		else if(cnt == Max) ans++;
		return;
	}
	for(int i = 1; i <= 80; i++) {
		if(!t[i]) continue;
		p[x] = i;
		t[i]--;
		dfs(x + 1);
		t[i]++;
	}
} 
int ksm(int x, int y) {
	int res = 1, pw = x;
	while(y) {
		if(y % 2) res = res * pw % Mod;
		pw = pw * pw % Mod;
		y /= 2;
	}
	return res;
}
signed main() {
	freopen("palindrome.in", "r", stdin);
	freopen("palindrome.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i], t[a[i]]++;
	int res = 0, cnt = 0, cnt1 = 0, cnt2 = 0;
	for(int i = 1; i <= 80; i++) {
		if(!t[i]) continue;
		if(t[i]) ++cnt;
		res += t[i] * (t[i] - 1) / 2;
		if(t[i] == 1) ++cnt1;
		else if(t[i] == 2) ++cnt2;
	}
	if(n <= 10) {
		dfs(1);
		cout << Max << " " << ans;
		return 0;
	}
	
	fac[0] = 1;
	for(int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % Mod;
	
	int tmp = fac[n];
	for(int i = 1; i <= 80; i++) tmp = tmp * ksm(fac[t[i]], Mod - 2) % Mod;
	cout << res + n << " " << tmp << endl;
	return 0;
}
/*
cnti*(cnti-1)
(cnti/2)(cnti/2-1)+cnti
*/

